3.11 \(\int \cot (c+d x) (a+b \tan (c+d x))^2 (B \tan (c+d x)+C \tan ^2(c+d x)) \, dx\)

Optimal. Leaf size=87 \[ -\frac{\left (a^2 C+2 a b B-b^2 C\right ) \log (\cos (c+d x))}{d}+x \left (a^2 B-2 a b C-b^2 B\right )+\frac{b (a C+b B) \tan (c+d x)}{d}+\frac{C (a+b \tan (c+d x))^2}{2 d} \]

[Out]

(a^2*B - b^2*B - 2*a*b*C)*x - ((2*a*b*B + a^2*C - b^2*C)*Log[Cos[c + d*x]])/d + (b*(b*B + a*C)*Tan[c + d*x])/d
 + (C*(a + b*Tan[c + d*x])^2)/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.135311, antiderivative size = 87, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 38, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.105, Rules used = {3632, 3528, 3525, 3475} \[ -\frac{\left (a^2 C+2 a b B-b^2 C\right ) \log (\cos (c+d x))}{d}+x \left (a^2 B-2 a b C-b^2 B\right )+\frac{b (a C+b B) \tan (c+d x)}{d}+\frac{C (a+b \tan (c+d x))^2}{2 d} \]

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]*(a + b*Tan[c + d*x])^2*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]

[Out]

(a^2*B - b^2*B - 2*a*b*C)*x - ((2*a*b*B + a^2*C - b^2*C)*Log[Cos[c + d*x]])/d + (b*(b*B + a*C)*Tan[c + d*x])/d
 + (C*(a + b*Tan[c + d*x])^2)/(2*d)

Rule 3632

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)
*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[1/b^2, Int[(a + b*Tan[e + f*x])
^(m + 1)*(c + d*Tan[e + f*x])^n*(b*B - a*C + b*C*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx &=\int (a+b \tan (c+d x))^2 (B+C \tan (c+d x)) \, dx\\ &=\frac{C (a+b \tan (c+d x))^2}{2 d}+\int (a+b \tan (c+d x)) (a B-b C+(b B+a C) \tan (c+d x)) \, dx\\ &=\left (a^2 B-b^2 B-2 a b C\right ) x+\frac{b (b B+a C) \tan (c+d x)}{d}+\frac{C (a+b \tan (c+d x))^2}{2 d}+\left (2 a b B+a^2 C-b^2 C\right ) \int \tan (c+d x) \, dx\\ &=\left (a^2 B-b^2 B-2 a b C\right ) x-\frac{\left (2 a b B+a^2 C-b^2 C\right ) \log (\cos (c+d x))}{d}+\frac{b (b B+a C) \tan (c+d x)}{d}+\frac{C (a+b \tan (c+d x))^2}{2 d}\\ \end{align*}

Mathematica [C]  time = 0.450116, size = 96, normalized size = 1.1 \[ \frac{2 b (2 a C+b B) \tan (c+d x)+(a-i b)^2 (C+i B) \log (\tan (c+d x)+i)+(a+i b)^2 (C-i B) \log (-\tan (c+d x)+i)+b^2 C \tan ^2(c+d x)}{2 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]*(a + b*Tan[c + d*x])^2*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]

[Out]

((a + I*b)^2*((-I)*B + C)*Log[I - Tan[c + d*x]] + (a - I*b)^2*(I*B + C)*Log[I + Tan[c + d*x]] + 2*b*(b*B + 2*a
*C)*Tan[c + d*x] + b^2*C*Tan[c + d*x]^2)/(2*d)

________________________________________________________________________________________

Maple [A]  time = 0.079, size = 140, normalized size = 1.6 \begin{align*} -{b}^{2}Bx+{\frac{{b}^{2}B\tan \left ( dx+c \right ) }{d}}-{\frac{B{b}^{2}c}{d}}+{\frac{{b}^{2}C \left ( \tan \left ( dx+c \right ) \right ) ^{2}}{2\,d}}+{\frac{{b}^{2}C\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}}-2\,{\frac{Bab\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}}-2\,Cabx+2\,{\frac{Cab\tan \left ( dx+c \right ) }{d}}-2\,{\frac{Cabc}{d}}+{a}^{2}Bx+{\frac{B{a}^{2}c}{d}}-{\frac{C{a}^{2}\ln \left ( \cos \left ( dx+c \right ) \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x)

[Out]

-b^2*B*x+1/d*b^2*B*tan(d*x+c)-1/d*B*b^2*c+1/2/d*b^2*C*tan(d*x+c)^2+b^2*C*ln(cos(d*x+c))/d-2/d*B*a*b*ln(cos(d*x
+c))-2*C*a*b*x+2/d*C*a*b*tan(d*x+c)-2/d*C*a*b*c+a^2*B*x+1/d*B*a^2*c-1/d*C*a^2*ln(cos(d*x+c))

________________________________________________________________________________________

Maxima [A]  time = 1.74923, size = 123, normalized size = 1.41 \begin{align*} \frac{C b^{2} \tan \left (d x + c\right )^{2} + 2 \,{\left (B a^{2} - 2 \, C a b - B b^{2}\right )}{\left (d x + c\right )} +{\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \,{\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(C*b^2*tan(d*x + c)^2 + 2*(B*a^2 - 2*C*a*b - B*b^2)*(d*x + c) + (C*a^2 + 2*B*a*b - C*b^2)*log(tan(d*x + c)
^2 + 1) + 2*(2*C*a*b + B*b^2)*tan(d*x + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.36793, size = 209, normalized size = 2.4 \begin{align*} \frac{C b^{2} \tan \left (d x + c\right )^{2} + 2 \,{\left (B a^{2} - 2 \, C a b - B b^{2}\right )} d x -{\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\frac{1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \,{\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(C*b^2*tan(d*x + c)^2 + 2*(B*a^2 - 2*C*a*b - B*b^2)*d*x - (C*a^2 + 2*B*a*b - C*b^2)*log(1/(tan(d*x + c)^2
+ 1)) + 2*(2*C*a*b + B*b^2)*tan(d*x + c))/d

________________________________________________________________________________________

Sympy [A]  time = 5.89005, size = 151, normalized size = 1.74 \begin{align*} \begin{cases} B a^{2} x + \frac{B a b \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - B b^{2} x + \frac{B b^{2} \tan{\left (c + d x \right )}}{d} + \frac{C a^{2} \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 C a b x + \frac{2 C a b \tan{\left (c + d x \right )}}{d} - \frac{C b^{2} \log{\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac{C b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text{for}\: d \neq 0 \\x \left (a + b \tan{\left (c \right )}\right )^{2} \left (B \tan{\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \cot{\left (c \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))**2*(B*tan(d*x+c)+C*tan(d*x+c)**2),x)

[Out]

Piecewise((B*a**2*x + B*a*b*log(tan(c + d*x)**2 + 1)/d - B*b**2*x + B*b**2*tan(c + d*x)/d + C*a**2*log(tan(c +
 d*x)**2 + 1)/(2*d) - 2*C*a*b*x + 2*C*a*b*tan(c + d*x)/d - C*b**2*log(tan(c + d*x)**2 + 1)/(2*d) + C*b**2*tan(
c + d*x)**2/(2*d), Ne(d, 0)), (x*(a + b*tan(c))**2*(B*tan(c) + C*tan(c)**2)*cot(c), True))

________________________________________________________________________________________

Giac [A]  time = 1.74418, size = 128, normalized size = 1.47 \begin{align*} \frac{C b^{2} \tan \left (d x + c\right )^{2} + 4 \, C a b \tan \left (d x + c\right ) + 2 \, B b^{2} \tan \left (d x + c\right ) + 2 \,{\left (B a^{2} - 2 \, C a b - B b^{2}\right )}{\left (d x + c\right )} +{\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(C*b^2*tan(d*x + c)^2 + 4*C*a*b*tan(d*x + c) + 2*B*b^2*tan(d*x + c) + 2*(B*a^2 - 2*C*a*b - B*b^2)*(d*x + c
) + (C*a^2 + 2*B*a*b - C*b^2)*log(tan(d*x + c)^2 + 1))/d